home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr47 / 335_01.zip / AS6502.TXT < prev    next >
Text File  |  1993-04-01  |  17KB  |  727 lines

  1.  
  2.  
  3.  
  4.                                   - 1 -
  5.  
  6.  
  7.  
  8.        A.  Appendix_for_as6502_Frankenstein_Assembler
  9.  
  10.        A.1  Pseudo_Operations
  11.  
  12.        A.1.1  Standard_Pseudo_Operation_Mnemonics
  13.  
  14.             End                                END
  15.             File Inclusion                     INCL INCLUDE
  16.             If                                 IF
  17.             Else                               ELSE
  18.             End If                             ENDI
  19.             Equate                             EQU
  20.             Set                                SET
  21.             Org                                ORG
  22.             Reserve Memory                     RESERVE RMB
  23.             Define Byte Data                   BYTE DB FCB
  24.             Define Word Data                   DW FDB WORD
  25.             Define String Data                 FCC STRING
  26.             Define Character Set Translation   CHARSET
  27.             Define Character Value             CHARDEF CHD
  28.             Use Character Translation          CHARUSE
  29.  
  30.        A.1.2  Machine_Dependent_Pseudo_Operations
  31.  
  32.        A.1.2.1  Define_Word_Data  The define word pseudo-operations
  33.        generates the byte reversed (low byte, high byte)
  34.        representation.
  35.  
  36.        A.1.2.2  Instruction_Set_Selection
  37.  
  38.             CPU string
  39.  
  40.        The instruction set can be specified in the source file with
  41.        the CPU pseudooperation.  The string, delimited by quotes or
  42.        apostrophes, is scanned for a substring which selects which
  43.        instruction set is used.  When the program is invoked, this
  44.        operation is performed on the name of the program, then the
  45.        -p optional arguement, if any, and then any CPU statements.
  46.        The last one selects which subset of the instructions the
  47.        assembler will accept.  The instruction set can be changed
  48.        at any place in the source file.
  49.  
  50.  
  51.             Instruction Set          Substrings
  52.             ROCKWELL CMOS            R65C r65c
  53.             CMOS                     65C 65c
  54.             ROCKWELL Extended        R65 r65
  55.             R65C00/21                21
  56.             Standard NMOS            65
  57.  
  58.  
  59.  
  60.  
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.                                   - 2 -
  71.  
  72.  
  73.  
  74.        A.2  Instructions
  75.  
  76.        A.2.1  Instruction_List
  77.  
  78.        Opcode   Syntax                       Selection Criteria
  79.  
  80.  
  81.        ADC       '#' topexpr
  82.        ADC       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  83.        ADC       '(' topexpr ')'             DIRECT INSTCMOS
  84.        ADC       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  85.        ADC       topexpr ',' INDEX           DIRECT INDEXX
  86.        ADC       topexpr ',' INDEX           EXTENDED INDEXX
  87.        ADC       topexpr ',' INDEX           INDEXY
  88.        ADC       topexpr                     DIRECT
  89.        ADC       topexpr                     EXTENDED
  90.  
  91.        AND       '#' topexpr
  92.        AND       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  93.        AND       '(' topexpr ')'             DIRECT INSTCMOS
  94.        AND       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  95.        AND       topexpr ',' INDEX           DIRECT INDEXX
  96.        AND       topexpr ',' INDEX           EXTENDED INDEXX
  97.        AND       topexpr ',' INDEX           INDEXY
  98.        AND       topexpr                     DIRECT
  99.        AND       topexpr                     EXTENDED
  100.  
  101.        ASL       ACCUM
  102.        ASL       topexpr ',' INDEX           DIRECT INDEXX
  103.        ASL       topexpr ',' INDEX           EXTENDED INDEXX
  104.        ASL       topexpr                     DIRECT
  105.        ASL       topexpr                     EXTENDED
  106.  
  107.        BBR0      topexpr ',' topexpr         INSTROCKWELL
  108.  
  109.        BBR1      topexpr ',' topexpr         INSTROCKWELL
  110.  
  111.        BBR2      topexpr ',' topexpr         INSTROCKWELL
  112.  
  113.        BBR3      topexpr ',' topexpr         INSTROCKWELL
  114.  
  115.        BBR4      topexpr ',' topexpr         INSTROCKWELL
  116.  
  117.        BBR5      topexpr ',' topexpr         INSTROCKWELL
  118.  
  119.        BBR6      topexpr ',' topexpr         INSTROCKWELL
  120.  
  121.        BBR7      topexpr ',' topexpr         INSTROCKWELL
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.                                   - 3 -
  137.  
  138.  
  139.  
  140.        Opcode   Syntax                       Selection Criteria
  141.  
  142.        BBS0      topexpr ',' topexpr         INSTROCKWELL
  143.  
  144.        BBS1      topexpr ',' topexpr         INSTROCKWELL
  145.  
  146.        BBS2      topexpr ',' topexpr         INSTROCKWELL
  147.  
  148.        BBS3      topexpr ',' topexpr         INSTROCKWELL
  149.  
  150.        BBS4      topexpr ',' topexpr         INSTROCKWELL
  151.  
  152.        BBS5      topexpr ',' topexpr         INSTROCKWELL
  153.  
  154.        BBS6      topexpr ',' topexpr         INSTROCKWELL
  155.  
  156.        BBS7      topexpr ',' topexpr         INSTROCKWELL
  157.  
  158.        BCC       topexpr
  159.  
  160.        BCS       topexpr
  161.  
  162.        BEQ       topexpr
  163.  
  164.        BGE       topexpr
  165.  
  166.        BIT       '#' topexpr                 INSTCMOS
  167.        BIT       topexpr ',' INDEX           DIRECT INDEXX INSTCMOS
  168.        BIT       topexpr ',' INDEX           EXTENDED INDEXX INSTCMOS
  169.        BIT       topexpr                     DIRECT
  170.        BIT       topexpr                     EXTENDED
  171.  
  172.        BLT       topexpr
  173.  
  174.        BMI       topexpr
  175.  
  176.        BNE       topexpr
  177.  
  178.        BPL       topexpr
  179.  
  180.        BRA       topexpr                     INST21
  181.        BRA       topexpr                     INSTCMOS
  182.  
  183.        BRK       '#' topexpr
  184.        BRK
  185.  
  186.        BVC       topexpr
  187.  
  188.        BVS       topexpr
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.  
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202.                                   - 4 -
  203.  
  204.  
  205.  
  206.        Opcode   Syntax                       Selection Criteria
  207.  
  208.  
  209.        CLC
  210.  
  211.        CLD
  212.  
  213.        CLI
  214.  
  215.        CLV
  216.  
  217.        CMP       '#' topexpr
  218.        CMP       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  219.        CMP       '(' topexpr ')'             DIRECT INSTCMOS
  220.        CMP       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  221.        CMP       topexpr ',' INDEX           DIRECT INDEXX
  222.        CMP       topexpr ',' INDEX           EXTENDED INDEXX
  223.        CMP       topexpr ',' INDEX           INDEXY
  224.        CMP       topexpr                     DIRECT
  225.        CMP       topexpr                     EXTENDED
  226.  
  227.        CPX       '#' topexpr
  228.        CPX       topexpr                     DIRECT
  229.        CPX       topexpr                     EXTENDED
  230.  
  231.        CPY       '#' topexpr
  232.        CPY       topexpr                     DIRECT
  233.        CPY       topexpr                     EXTENDED
  234.  
  235.        DEC       ACCUM                       INSTCMOS
  236.        DEC       topexpr ',' INDEX           DIRECT INDEXX
  237.        DEC       topexpr ',' INDEX           EXTENDED INDEXX
  238.        DEC       topexpr                     DIRECT
  239.        DEC       topexpr                     EXTENDED
  240.  
  241.        DEX
  242.  
  243.        DEY
  244.  
  245.        EOR       '#' topexpr
  246.        EOR       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  247.        EOR       '(' topexpr ')'             DIRECT INSTCMOS
  248.        EOR       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  249.        EOR       topexpr ',' INDEX           DIRECT INDEXX
  250.        EOR       topexpr ',' INDEX           EXTENDED INDEXX
  251.        EOR       topexpr ',' INDEX           INDEXY
  252.        EOR       topexpr                     DIRECT
  253.        EOR       topexpr                     EXTENDED
  254.  
  255.  
  256.  
  257.  
  258.  
  259.  
  260.  
  261.  
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268.                                   - 5 -
  269.  
  270.  
  271.  
  272.        Opcode   Syntax                       Selection Criteria
  273.  
  274.        INC       ACCUM                       INSTCMOS
  275.        INC       topexpr ',' INDEX           DIRECT INDEXX
  276.        INC       topexpr ',' INDEX           EXTENDED INDEXX
  277.        INC       topexpr                     DIRECT
  278.        INC       topexpr                     EXTENDED
  279.  
  280.        INX
  281.  
  282.        INY
  283.  
  284.        JMP       '(' topexpr ')'
  285.        JMP       '(' topexpr ',' INDEX ')'   INSTCMOS INDEXX
  286.        JMP       topexpr
  287.  
  288.        JSR       topexpr
  289.  
  290.        LDA       '#' topexpr
  291.        LDA       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  292.        LDA       '(' topexpr ')'             DIRECT INSTCMOS
  293.        LDA       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  294.        LDA       topexpr ',' INDEX           DIRECT INDEXX
  295.        LDA       topexpr ',' INDEX           EXTENDED INDEXX
  296.        LDA       topexpr ',' INDEX           INDEXY
  297.        LDA       topexpr                     DIRECT
  298.        LDA       topexpr                     EXTENDED
  299.  
  300.        LDX       '#' topexpr
  301.        LDX       topexpr ',' INDEX           DIRECT INDEXY
  302.        LDX       topexpr ',' INDEX           EXTENDED INDEXY
  303.        LDX       topexpr                     DIRECT
  304.        LDX       topexpr                     EXTENDED
  305.  
  306.        LDY       '#' topexpr
  307.        LDY       topexpr ',' INDEX           DIRECT INDEXX
  308.        LDY       topexpr ',' INDEX           EXTENDED INDEXX
  309.        LDY       topexpr                     DIRECT
  310.        LDY       topexpr                     EXTENDED
  311.  
  312.        LSR       ACCUM
  313.        LSR       topexpr ',' INDEX           DIRECT INDEXX
  314.        LSR       topexpr ',' INDEX           EXTENDED INDEXX
  315.        LSR       topexpr                     DIRECT
  316.        LSR       topexpr                     EXTENDED
  317.  
  318.        MUL                                   INST21
  319.  
  320.        NOP
  321.  
  322.  
  323.  
  324.  
  325.  
  326.  
  327.  
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334.                                   - 6 -
  335.  
  336.  
  337.  
  338.        Opcode   Syntax                       Selection Criteria
  339.  
  340.  
  341.        ORA       '#' topexpr
  342.        ORA       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  343.        ORA       '(' topexpr ')'             DIRECT INSTCMOS
  344.        ORA       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  345.        ORA       topexpr ',' INDEX           DIRECT INDEXX
  346.        ORA       topexpr ',' INDEX           EXTENDED INDEXX
  347.        ORA       topexpr ',' INDEX           INDEXY
  348.        ORA       topexpr                     DIRECT
  349.        ORA       topexpr                     EXTENDED
  350.  
  351.        PHA
  352.  
  353.        PHP
  354.  
  355.        PHX                                   INST21
  356.        PHX                                   INSTCMOS
  357.  
  358.        PHY                                   INST21
  359.        PHY                                   INSTCMOS
  360.  
  361.        PLA
  362.  
  363.        PLP
  364.  
  365.        PLX                                   INST21
  366.        PLX                                   INSTCMOS
  367.  
  368.        PLY                                   INST21
  369.        PLY                                   INSTCMOS
  370.  
  371.        RMB0      topexpr                     INSTROCKWELL
  372.  
  373.        RMB1      topexpr                     INSTROCKWELL
  374.  
  375.        RMB2      topexpr                     INSTROCKWELL
  376.  
  377.        RMB3      topexpr                     INSTROCKWELL
  378.  
  379.        RMB4      topexpr                     INSTROCKWELL
  380.  
  381.        RMB5      topexpr                     INSTROCKWELL
  382.  
  383.        RMB6      topexpr                     INSTROCKWELL
  384.  
  385.        RMB7      topexpr                     INSTROCKWELL
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.  
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400.                                   - 7 -
  401.  
  402.  
  403.  
  404.        Opcode   Syntax                       Selection Criteria
  405.  
  406.        ROL       ACCUM
  407.        ROL       topexpr ',' INDEX           DIRECT INDEXX
  408.        ROL       topexpr ',' INDEX           EXTENDED INDEXX
  409.        ROL       topexpr                     DIRECT
  410.        ROL       topexpr                     EXTENDED
  411.  
  412.        ROR       ACCUM
  413.        ROR       topexpr ',' INDEX           DIRECT INDEXX
  414.        ROR       topexpr ',' INDEX           EXTENDED INDEXX
  415.        ROR       topexpr                     DIRECT
  416.        ROR       topexpr                     EXTENDED
  417.  
  418.        RTI
  419.  
  420.        RTS
  421.  
  422.        SBC       '#' topexpr
  423.        SBC       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  424.        SBC       '(' topexpr ')'             DIRECT INSTCMOS
  425.        SBC       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  426.        SBC       topexpr ',' INDEX           DIRECT INDEXX
  427.        SBC       topexpr ',' INDEX           EXTENDED INDEXX
  428.        SBC       topexpr ',' INDEX           INDEXY
  429.        SBC       topexpr                     DIRECT
  430.        SBC       topexpr                     EXTENDED
  431.  
  432.        SEC
  433.  
  434.        SED
  435.  
  436.        SEI
  437.  
  438.        SMB0      topexpr                     INSTROCKWELL
  439.  
  440.        SMB1      topexpr                     INSTROCKWELL
  441.  
  442.        SMB2      topexpr                     INSTROCKWELL
  443.  
  444.        SMB3      topexpr                     INSTROCKWELL
  445.  
  446.        SMB4      topexpr                     INSTROCKWELL
  447.  
  448.        SMB5      topexpr                     INSTROCKWELL
  449.  
  450.        SMB6      topexpr                     INSTROCKWELL
  451.  
  452.        SMB7      topexpr                     INSTROCKWELL
  453.  
  454.  
  455.  
  456.  
  457.  
  458.  
  459.  
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466.                                   - 8 -
  467.  
  468.  
  469.  
  470.        Opcode   Syntax                       Selection Criteria
  471.  
  472.  
  473.        STA       '(' topexpr ')' ',' INDEX   DIRECT INDEXY
  474.        STA       '(' topexpr ')'             DIRECT INSTCMOS
  475.        STA       '(' topexpr ',' INDEX ')'   DIRECT INDEXX
  476.        STA       topexpr ',' INDEX           DIRECT INDEXX
  477.        STA       topexpr ',' INDEX           EXTENDED INDEXX
  478.        STA       topexpr ',' INDEX           INDEXY
  479.        STA       topexpr                     DIRECT
  480.        STA       topexpr                     EXTENDED
  481.  
  482.        STX       topexpr ',' INDEX           DIRECT INDEXY
  483.        STX       topexpr                     DIRECT
  484.        STX       topexpr                     EXTENDED
  485.  
  486.        STY       topexpr ',' INDEX           DIRECT INDEXX
  487.        STY       topexpr                     DIRECT
  488.        STY       topexpr                     EXTENDED
  489.  
  490.        STZ       topexpr ',' INDEX           DIRECT INDEXX INSTCMOS
  491.        STZ       topexpr ',' INDEX           EXTENDED INDEXX INSTCMOS
  492.        STZ       topexpr                     DIRECT INSTCMOS
  493.        STZ       topexpr                     EXTENDED INSTCMOS
  494.  
  495.        TAX
  496.  
  497.        TAY
  498.  
  499.        TRB       topexpr                     DIRECT INSTCMOS
  500.        TRB       topexpr                     EXTENDED INSTCMOS
  501.  
  502.        TSB       topexpr                     DIRECT INSTCMOS
  503.        TSB       topexpr                     EXTENDED INSTCMOS
  504.  
  505.        TSX
  506.  
  507.        TXA
  508.  
  509.        TXS
  510.  
  511.        TYA
  512.  
  513.        A.2.2  Operands
  514.  
  515.             ACCUM               The a or (A) reserved symbol
  516.  
  517.             INDEX               The x or y (or X or Y) reserved
  518.                                 symbols
  519.  
  520.  
  521.  
  522.  
  523.  
  524.  
  525.  
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532.                                   - 9 -
  533.  
  534.  
  535.  
  536.        A.2.3  Selection_Criteria_Keywords
  537.  
  538.             DIRECT              The instruction can use the direct
  539.                                 addressing mode. The expression
  540.                                 must have a value between 0 and 255
  541.                                 that is defined when the
  542.                                 instruction is processed in the
  543.                                 input pass.
  544.  
  545.             EXTENDED            The instruction can use the
  546.                                 extended (16 bit address) mode.
  547.  
  548.             INDEXX              The instruction can use the X
  549.                                 index.
  550.  
  551.             INDEXY              The instruction can use the Y
  552.                                 index.
  553.  
  554.             INSTCMOS            The instruction is in the CMOS and
  555.                                 ROCKWELL CMOS instruction sets.
  556.  
  557.             INSTROCKWELL        The instruction is in the ROCKWELL,
  558.                                 ROCKWELL CMOS, and R65c00/21
  559.                                 instruction sets.
  560.  
  561.             INST21              The instruction is in the R65c00/21
  562.                                 instruction set.
  563.  
  564.        A.2.4  Apostrophes  The apostrophes in the syntax field are
  565.        a notation used for the parser generator and are not put in
  566.        the assembler source statement.
  567.  
  568.        A.3  Notes
  569.  
  570.        A.3.1  Top_Expressions  The syntax of some of the
  571.        instructions combined with the standard expression syntax
  572.        resulted in confusion whether an operand was an expression
  573.        surrounded by parenthesis, or a indexed reference. To get
  574.        around this, the expressions in these ambiguous cases were
  575.        restricted to those forms of expression that don't have
  576.        surrounding parenthesis at the top level.  Subexpressions
  577.        may be parenthesized, but only if an operator seperates or
  578.        precedes the subexpression.
  579.  
  580.             Example
  581.  
  582.             lda 47h,y       ; load absolute, y
  583.             lda +(47h),y    ; load absolute, y
  584.             lda (47h),y     ; load (indirect), y
  585.             lda ((47h)),y   ; error
  586.  
  587.  
  588.  
  589.  
  590.  
  591.  
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598.                                   - 10 -
  599.  
  600.  
  601.  
  602.        A.3.2  Reserved_Symbols
  603.  
  604.        A.3.2.1  Machine_Dependent_Reserved_Symbols  A X Y a x y
  605.  
  606.        A.3.2.2  Standard_Reserved_Symbols  AND DEFINED EQ GE GT
  607.        HIGH LE LOW LT MOD NE NOT OR SHL SHR XOR and defined eq ge
  608.        gt high le low lt mod ne not or shl shr xor
  609.  
  610.  
  611.  
  612.  
  613.  
  614.  
  615.  
  616.  
  617.  
  618.  
  619.  
  620.  
  621.  
  622.  
  623.  
  624.  
  625.  
  626.  
  627.  
  628.  
  629.  
  630.  
  631.  
  632.  
  633.  
  634.  
  635.  
  636.  
  637.  
  638.  
  639.  
  640.  
  641.  
  642.  
  643.  
  644.  
  645.  
  646.  
  647.  
  648.  
  649.  
  650.  
  651.  
  652.  
  653.  
  654.  
  655.  
  656.  
  657.  
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664.  
  665.  
  666.  
  667.  
  668.                                  CONTENTS
  669.  
  670.  
  671.        A.  Appendix for as6502 Frankenstein Assembler...........  1
  672.            A.1  Pseudo Operations...............................  1
  673.            A.2  Instructions....................................  2
  674.            A.3  Notes...........................................  9
  675.  
  676.  
  677.  
  678.  
  679.  
  680.  
  681.  
  682.  
  683.  
  684.  
  685.  
  686.  
  687.  
  688.  
  689.  
  690.  
  691.  
  692.  
  693.  
  694.  
  695.  
  696.  
  697.  
  698.  
  699.  
  700.  
  701.  
  702.  
  703.  
  704.  
  705.  
  706.  
  707.  
  708.  
  709.  
  710.  
  711.  
  712.  
  713.  
  714.  
  715.  
  716.  
  717.  
  718.  
  719.  
  720.  
  721.  
  722.                                   - i -
  723.  
  724.  
  725.  
  726.  
  727.